package com.bwf.ticket;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/19 15:52
 * @Copyright 博为峰
 */
public class Ticket02 implements Runnable {
    private int num = 100;

    @Override
    public void run() {
        while (true) {
            if (num > 0) {//2
                try {
                    //t0 1   t1 0
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName() + ":num=" + num--);
            } else {
                break;
            }
        }
    }
}
